package hongcaosp.app.android.modle.impl;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.AbsCallback;
import com.lzy.okgo.model.HttpParams;

import hongcaosp.app.android.BuildConfig;
import hongcaosp.app.android.modle.BaseResponse;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.bean.ChargeMoneyWrap;
import hongcaosp.app.android.modle.bean.Income;
import hongcaosp.app.android.modle.bean.Pagebean;
import hongcaosp.app.android.modle.bean.PayOrder;
import hongcaosp.app.android.modle.bean.UserWalletWrap;
import hongcaosp.app.android.modle.mi.UserWalletModel;

public class UserWalletModelImpl implements UserWalletModel {

    @Override
    public void rechargeList(String token, int operationType,DataCallBack<ChargeMoneyWrap> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        params.put("operationType",operationType);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/membervip/rechargeList").params(params).execute(callBack);
    }

    @Override
    public void userWallet(String token, DataCallBack<UserWalletWrap> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/wallet/userWallet").params(params).execute(callBack);
    }

    @Override
    public void openMember(String token, int type, int operationType, long id, DataCallBack<PayOrder> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        params.put("type",type);
        params.put("operationType",operationType);
        params.put("id",id);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/membervip/openMember").params(params).execute(callBack);
    }

    @Override
    public void bindingPayType(String token, int type, String account,DataCallBack<BaseResponse> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        params.put("type",type);
        params.put("account",account);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/user/bindingPayType").params(params).execute(callBack);
    }

    @Override
    public void cashWithdrawal(String token, int type, double amount,AbsCallback<BaseResponse> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        params.put("type",type);
        params.put("amount",amount);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/wallet/cashWithdrawal").params(params).execute(callBack);
    }

    @Override
    public void rechargeRecord(String token, int type, int pageNumber, int pageSize, DataCallBack<Pagebean<Income>> callBack) {
        HttpParams params = new HttpParams();
        params.put("token",token);
        params.put("type",type);
        params.put("pageNumber",pageNumber);
        params.put("pageSize",pageSize);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/wallet/rechargeRecord").params(params).execute(callBack);
    }
}
